package com.jiexin.util;

import com.google.common.base.Splitter;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: Jay_Liu
 * @Description:
 * @Date: Created in 17:40 2018/4/26 0026
 * @Modified By:
 */
public class StringUtil {

    /**
     * 通过分隔符分割字符串成整型集合
     * @param str 待分割字段
     * @param separator 分割符
     * @return 整型集合
     */
    public static List<Integer> splitToListInt(String str, String separator){
        List<String> strList = Splitter.on(separator).trimResults().omitEmptyStrings().splitToList(str);
        return strList.stream().map(strItem -> Integer.parseInt(strItem)).collect(Collectors.toList());
    }

}
